package com.jprocms.module.cms.api.dto;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.util.StringUtils;

import static com.jprocms.module.cms.constant.CmsSysConstants.SUFFIX;


/**
 * @author jprocms
 */
@Data
public class SiteContentDefTplDto {

    private Long id;
    /**
     * 模型ID
     */
    @Schema(description = "模型ID")
    private Long modelId;

    /**
     * 模板路径
     */
    @Schema(description = "模板路径")
    private String detailTpl;

    public void setDetailTpl(String detailTpl) {
        if (StringUtils.endsWithIgnoreCase(detailTpl, SUFFIX)) {
            detailTpl = detailTpl.substring(0, detailTpl.lastIndexOf(SUFFIX));
        }
        this.detailTpl = detailTpl;
    }

    /**
     * 站点ID
     */
    private Long siteId;

    /**
     * 发布平台ID
     */
    private Long platformId;


}
